<?php

require_once 'smarty_lib/Smarty.class.php';
require_once 'lib/DBClass.php';
require_once 'lib/Account.php';
require_once 'lib/Negara.php';

$smarty = new Smarty();
$acc = new Account();
$negara = new Negara();

$smarty->template_dir = 'template/';
$smarty->compile_dir = 'template_c/';

if(!$acc->validate_cookie()){
	$smarty->assign('error','Anda tidak mepunyai akses untuk membuka halaman ini');
	$smarty->display('index.html');
}else{

	$page = 10;
	$start = (empty($_GET['pg']))?0:($_GET['pg']-1)*$page;		
	$paging = ceil($negara->get_num_row()/$page);


	$smarty->assign('negara',$negara->get_all_negara($start, $page));	
	$smarty->assign('paging',$paging);	
	$smarty->assign('select',$_GET['pg']);	
	$smarty->assign('page','negara.html');
	$smarty->assign('title','Data Negara');
	$smarty->display('dashboard.html');
}